package com.gzq.controller;

import com.gzq.entity.NewText;
import com.gzq.repository.NewTextDao;
import com.gzq.service.NewTextService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("news")
public class NewTextController {
    @Resource
    NewTextService newTextService;
    @RequestMapping("findall")
    public Map findAll(){
        Map map = new HashMap();
        map.put("news",newTextService.findAll());
        return map;
    }
    @RequestMapping("findbyid/{id}")
    public Map findById(@PathVariable("id") long id){
        Map map =new HashMap();
        map.put("news",newTextService.findById(id));
        return  map;
    }
}
